//
// Created by ASUS on 2024/4/17/星期三.
//

/*
 * [l,r]之间有多少个数奇数位数量等于偶数位数量
 * 1<<l<<r<<1e18
 */
#include <bits/stdc++.h>
using namespace std;
using ll=long long;

int main(){
	ll l,r;cin>>l>>r;
	string low=to_string(l);
	string high=to_string(r);
	int n=high.size();
	low=string(n-low.size(),'0')+low;
	vector<vector<ll>> memo(n,vector<ll>(2*n+1,-1));
	function<ll(int,bool,bool,bool,int)>dfs=[&](int i,bool limit_low,bool limit_high,bool is_num,int cnt)->ll{
		if(i==n) return cnt==0&&is_num;
		if(is_num&&!limit_low&&!limit_high&&memo[i][cnt+n]!=-1) return memo[i][cnt+n];
		ll res=0;
		if(!is_num&&low[i]=='0'){
			res+=dfs(i+1,true,false,false,cnt);
		}
		int d0=is_num?0:1;
		int lo=limit_low?low[i]-'0':0;
		int hi=limit_high?high[i]-'0':9;
		for(int d=max(d0,lo);d<=hi;d++){
			res += dfs(i + 1, limit_low && d == lo, limit_high && d == hi,true,cnt+(d%2)*2-1);
		}
		if (!limit_low && !limit_high&&is_num) {
			memo[i][cnt+n] = res;
		}
		return res;
	};
	cout<<dfs(0,true,true,false,0);
	return 0;
}